﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Admin_QL_SACH.aspx.cs" Inherits="Admin_Admin_QL_SACH" %>

<asp:Content ID="Content1" ContentPlaceHolderID="NoiDung" Runat="Server">
    <div style="width:580px">
    <div>
        <asp:Panel ID="PanelThongTin" runat="server" Visible="False">
            <div class="div-table" style="width:580px; text-align: center;">
            <div class="div-table-row">
                <div class="div-table-col" style="width:80px; vertical-align: top;">
                    <asp:Image ID="Image_sach" runat="server" Height="100px" Width="80px" />
                </div>
                <div class="div-table-col" style="width:500px; vertical-align: top;">
            
                    <table width="100%" align="left">
                        <tr>
                            <td width="100" align="left">
                                &nbsp;</td>
                            <td width="400" align="left">
                                <asp:Label ID="LabelId" runat="server" Text="Label" Visible="False"></asp:Label></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Mã sách:</td>
                            <td align="left">
                                <asp:TextBox ID="txtMaSach" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Tên sách:</td>
                            <td align="left">
                                <asp:TextBox ID="txtTenSach" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Tác giả:</td>
                            <td align="left">
                                <asp:TextBox ID="txtTacGia" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Nội dung:</td>
                            <td align="left">
                                <textarea ID="txtNoiDung" runat="server" name="S1" 
                                    style="resize:none; height: 100px; width: 300px;"></textarea></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Giá bán:</td>
                            <td align="left">
                                <asp:TextBox ID="txtGiaSach" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td align="left">
                                Thể loại:</td>
                            <td align="left">
                                <asp:DropDownList ID="DropDownListTheLoai" runat="server" Width="300px">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                Nhà xuất bản</td>
                            <td align="left">
                                <asp:DropDownList ID="DropDownListNXB" runat="server" Width="300px">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                Hình ảnh:</td>
                            <td align="left">
                                <asp:FileUpload ID="FileUpload1" runat="server" Width="220px" />
                                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                            ControlToValidate="FileUpload1" Display="Dynamic" 
                                            ErrorMessage="Không phải file ảnh" 
                                            ValidationExpression="^([0-9a-zA-Z_\-~ :\\])+(.jpg|.JPG|.jpeg|.JPEG|.bmp|.BMP|.gif|.GIF|.png|.PNG)$"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">
                                <asp:Button ID="btnXoa" runat="server" onclick="btnXoa_Click" Text="Xoá" OnClientClick="javascript: return DeleteConfirm();"/>
                            </td>
                            <td align="left">
                                <asp:Button ID="btnCapNhat" runat="server" onclick="btnCapNhat_Click" 
                                    Text="Cập nhật" Width="78px" />
                                <asp:Button ID="btnLMoi" runat="server" onclick="btnLMoi_Click" Text="Lưu" />
                            </td>
                        </tr>
                    </table>
            
                </div>
            </div>
     </div>
        </asp:Panel>
                                <asp:Button ID="btnThem" runat="server" 
            onclick="btnThem_Click" Text="Thêm" />
        <br />

        
    </div>





        <div align="center">
            DANH SÁCH SÁCH
        </div>
        <div align="center">
            <asp:gridview runat="server" ID="gridview_Sach" AutoGenerateColumns="False" 
                onpageindexchanging="gridview_Sach_PageIndexChanging" 
                onsorting="gridview_Sach_Sorting" DataSourceID="ObjectDataSourceSach" 
                AllowPaging="True" Width="580px" 
                onselectedindexchanged="gridview_Sach_SelectedIndexChanged" 
                CellPadding="4" ForeColor="#333333" GridLines="None">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="idSach" HeaderText="Id" 
                        SortExpression="idSach" ReadOnly="True" />
                    <asp:BoundField DataField="maSach" HeaderText="Mã sách" 
                        SortExpression="maSach" />
                    <asp:BoundField DataField="tenSach" HeaderText="Tên sách" 
                        SortExpression="tenSach" />
                    <asp:BoundField DataField="tacGia" HeaderText="Tác giả" 
                        SortExpression="tacGia" />
                    <asp:BoundField DataField="giaSach" HeaderText="Giá sách" 
                        SortExpression="giaSach" />
                    <asp:BoundField DataField="ndSach" HeaderText="Nội dung" 
                        SortExpression="ndSach" Visible="False" />
                    <asp:BoundField DataField="idTheLoai" HeaderText="Thể loại" 
                        SortExpression="idTheLoai" Visible="False" />
                    <asp:BoundField DataField="idNXB" HeaderText="idNXB" 
                        SortExpression="idNXB" Visible="False" />
                    <asp:BoundField DataField="TenNXB" HeaderText="Nhà xuất bản" ReadOnly="True" 
                        SortExpression="TenNXB" />
                    <asp:BoundField DataField="TenTheLoai" HeaderText="Thể loại" ReadOnly="True" 
                        SortExpression="TenTheLoai" />
                    <asp:CommandField ButtonType="Button" SelectText="Chọn" 
                        ShowSelectButton="True" CausesValidation="False" />
                </Columns>
                <EditRowStyle BackColor="#7C6F57" />
                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#E3EAEB" />
                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F8FAFA" />
                <SortedAscendingHeaderStyle BackColor="#246B61" />
                <SortedDescendingCellStyle BackColor="#D4DFE1" />
                <SortedDescendingHeaderStyle BackColor="#15524A" />
            </asp:gridview>
            <asp:ObjectDataSource ID="ObjectDataSourceSach" runat="server" 
                DataObjectTypeName="Biz_Dal.Biz.BizSach" DeleteMethod="deleteSach" 
                InsertMethod="insertSach" SelectMethod="getListSachAll" 
                TypeName="Biz_Dal.Biz.BizSach" UpdateMethod="updateSach">
                <DeleteParameters>
                    <asp:Parameter Name="maSach" Type="String" />
                </DeleteParameters>
            </asp:ObjectDataSource>
        </div>
    </div>
</asp:Content>

